<include file="./Tpl/Public/header.html" />
<h1>
    <span class="action-span1">{$current_operation[g][title]}->{$current_operation[m][title]}->{$current_operation[a][title]}</span>
    <foreach name="list_main_menu" item="info">
    <span class="action-span"><a href="{$info[url]}" target="{$info[target]}">{$info[title]}</a></span>
    </foreach>
    <div style="clear:both"></div>
</h1>
<div class="form-div">
					  <form name="searchForm" action="">
					    <img width="26" height="22" border="0" alt="SEARCH" src="__PUBLIC__/images/icon_search.gif">
					    产品名称：<input name='cpmc' type='text' value='{$Think.request.cpmc}' />
产品代码：<input name='cpdm' type='text' value='{$Think.request.cpdm}' />

					    <input type="submit" class="button" value=" 搜索 ">
					  </form>
					</div>
<div class="list-div">
<table cellspacing='1' cellpadding='3'>
  <tr>
    <th>序号</th>
    <th><a href="?_order=cpmc&_sort={$sort}">产品名称</a><if condition="$order eq 'cpmc'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th><th><a href="?_order=cpdm&_sort={$sort}">产品代码</a><if condition="$order eq 'cpdm'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th><th><a href="?_order=bssl&_sort={$sort}">报损数量</a><if condition="$order eq 'bssl'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th><th><a href="?_order=bsyy&_sort={$sort}">报损原因</a><if condition="$order eq 'bsyy'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th><th><a href="?_order=cpszck&_sort={$sort}">产品所在仓库</a><if condition="$order eq 'cpszck'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th>
    <th>操作</th>
    </tr>
  <foreach name="list" item="info" key="k">
  <php>if($i++%2==0){ $class='even'; }else{ $class='odd'; }</php>
  <tr class="{$class}">
	<td>{$k+1}</td>
    <td>{$info[name]}</td>
    <td>{$info[code]}</td>
    <td>{$info[number]}</td>
    <td>{$info[remark]}</td>
    <td>{$info[storage_id]}</td>
    <td>
        <a href="javascript:dialog_edit('{$info[id]}');">修改 </a>| 
        <a href="javascript:confirm_delete('{$info[id]}');">删除</a>
    </td>
    </tr>
  </foreach>
</table>
<div id="turn-page">{$page}</div>
</div>
<div id="dialog_add"><!--添加信息 --></div>
<div id="dialog_edit"><!-- 修改信息--></div>
<div id="dialog_delete" style="color:#F00; font-size:13px; vertical-align: middle;">"彻底删除"的数据是不可恢复的，请慎用！</div>
<script type="text/javascript">
$("#dialog_add").dialog({
    autoOpen: false,
    title: '添加信息',
    width:'480',
    height:'75',
    modal: true,
    buttons: {
        '确认': function () {
   			$("#dialog_add form").submit();
   		},
        '取消': function () {
           $("#dialog_add").dialog("close");
        }
    }
});
function dialog_add(){
	var uri='{:U("add")}';
	$.ajax({
		type: "get",
		url: uri,
		dataType:"html",
		success: function(html){
			$("#dialog_add").html(html);
			$("#dialog_add").dialog("open");
		}
	});
}
$("#dialog_edit").dialog({
    autoOpen: false,
    title: '修改信息',
    width:'480',
    height:'75',
    modal: true,
    buttons: {
        '确认': function () {
   			$("#dialog_edit form").submit();
   		},
        '取消': function () {
           $("#dialog_edit").dialog("close");
        }
    }
});
function dialog_edit(id){
	var uri='{:U("edit?id=")}'+id;
	$.ajax({
		type: "get",
		url: uri,
		dataType:"html",
		success: function(html){
			$("#dialog_edit").html(html);
			$("#dialog_edit").dialog("open");
		}
	});
}
//删除数据
var delete_id="";
$("#dialog_delete").dialog({
    autoOpen: false,
    title: '删除信息',
    width:'270',
    height:'150',
    modal: true,
    buttons: {
        '丢到垃圾站': function () {
        	window.location.href='{:U("delete?id=")}'+delete_id;
   		},
        '彻底删除': function () {
			window.location.href='{:U("foreverdelete?id=")}'+delete_id;
        },
		'取消': function () {
           $("#dialog_delete").dialog("close");
        }
    }
});
function confirm_delete(id){
	delete_id=id;
	$("#dialog_delete").dialog("open");
}
</script>
<include file="./Tpl/Public/footer.html" />